#define _CRT_SECURE_NO_WARNINGS 1
#include"Date.h"
//int main()
//{
//	Date d1(2023, 11, 7);
//	Date d2(2010, 2, 24);
//	d1 = d2;
//	cout << d2 - d1 << endl;
//	(d2 -=10000).print(); 
//	cout << d2 - d1 << endl;
//}
//#include <iostream>
//using namespace std;
//int GetMonthDay(int year, int month)
//{
//    int arr[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
//    if (month == 2 && ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0))
//    {
//        return 29;
//    }
//    return arr[month];
//}
//int main() {
//    int year = 0; int month = 0; int day = 0;
//    cin >> year >> month >> day;
//    int count = 1;
//    int all = day;
//    while (count != month)
//    {
//        all += GetMonthDay(year, count);
//        count++;
//    }
//    cout << all << endl;
//}
#include <iostream>
#include<stdio.h>
using namespace std;
int GetMonthDay(int year, int month)
{
    int arr[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
    if (month == 2 && (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)))
    {
        return 29;
    }
    return arr[month];
}
int main() {
    int year = 0; int day = 0;
    int month = 1;
    while ((scanf("%d %d",&year, &day)) != EOF)
    {
        while (day > GetMonthDay(year, month))
        {
            day -= GetMonthDay(year, month);
            month++;
            if (month > 12)
            {
                month = 1;
                year++;
            }
        }
        cout << year << "-" << month << "-" << day << endl;
    }
}